import { PureComponent } from "react";
import ThemContext from "../context";

function originComponent(Old_cpn) {
    return () => {
        class NewComponent extends PureComponent {
            render() {
                return (
                    <ThemContext.Consumer>
                          {value =>{
                            return (
                               <Old_cpn {...this.props}  {...this.value}/>
                            )
                          }}
                    </ThemContext.Consumer>
                );
            }
        }
        NewComponent.contextType = ThemContext;
        return NewComponent;
    }
}

export default originComponent;